
TRIGGER PROCEDURE FOR WRITE OF MRP_DET OLD BUFFER OLD_MRP_DET.


{mfdeclre.i }
define new shared work-table wf_old_mrp_det like mrp_det.

/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if not can-find ( first dt_mstr where dt_table = "mrp_det" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_mrp_det ) then do:
        create wf_old_mrp_det.
        if recid(wf_old_mrp_det)= -1 then .
    end.
    
    buffer-copy old_mrp_det to wf_old_mrp_det no-error.
    
    if mrp_det.mrp_dataset <> "sod_det" then return.

    for each dt_mstr no-lock where dt_table = "mrp_det" and dt_type = "MOD" :
    
        case dt_field :

            when "mrp_dataset" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_dataset, input mrp_det.mrp_dataset,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_part, input mrp_det.mrp_part,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_nbr, input mrp_det.mrp_nbr,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_line, input mrp_det.mrp_line,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_rel_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_mrp_det.mrp_rel_date), input string(mrp_det.mrp_rel_date),
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_due_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_mrp_det.mrp_due_date), input string(mrp_det.mrp_due_date),
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_qty" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_mrp_det.mrp_qty), input string(mrp_det.mrp_qty),
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_type, input mrp_det.mrp_type,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_detail" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_detail, input mrp_det.mrp_detail,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp__qad01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_mrp_det.mrp__qad01), input string(mrp_det.mrp__qad01),
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_site, input mrp_det.mrp_site,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_user1, input mrp_det.mrp_user1,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_user2, input mrp_det.mrp_user2,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_line2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_line2, input mrp_det.mrp_line2,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_ord_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_mrp_det.mrp_ord_site, input mrp_det.mrp_ord_site,
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").

            when "mrp_keyid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_mrp_det.mrp_keyid), input string(mrp_det.mrp_keyid),
                    input recid(mrp_det), input mrp_det.mrp_dataset, input mrp_det.mrp_part, input mrp_det.mrp_nbr, input mrp_det.mrp_line,
                    input mrp_det.mrp_line2, input "", input "", input "").
        end.
    end.
end.

{hkdttrans.i}
